package _1008.bookmanagement;

import java.util.Set;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class BookDaoImplTest {

	BookDaoImpl impl = new BookDaoImpl();
	
	@Before
	public void testAdd() {
		impl.add(new Book(1,"a","a1",100));
		impl.add(new Book(1,"a1","a1",1100));
		impl.add(new Book(2,"ab","a2",101));
		impl.add(new Book(3,"ac","a3",102));
		impl.add(new Book(4,"ad","a4",103));
		impl.add(new Book(5,"ae","a5",104));
		impl.add(new Book(6,"af","a6",106));
		impl.add(new Book(7,"ag","a7",107));
	}

	@Test
	public void testUpdate() {
		impl.update(new Book(2,"bbb","bbb",20));
	}

	@Test
	public void testRemove() {
		impl.remove(4);
	}

	@Test
	public void testSelectById() {
		Book selectById = impl.selectById(5);
		System.out.println(selectById);
	}

	@After
	public void testSelectAll() {
		Set<Book> selectAll = impl.selectAll();
		selectAll.forEach(System.out::println);
	}

}
